import router from "@/router/routes"
import searchImage from "@/assets/search.png"
import userImage from "@/assets/user.png"

export function useMenuList() {
    const menuList = router[0].children
        .filter(route => route.meta && route.meta.menu)
        .map(route => {
            const menuItem = {
                label: route.name,
                key: route.path,
                breadcrumb: route.meta.breadcrumb
            };

            if (route.meta.children && route.meta.children.length > 0) {
                menuItem.children = route.meta.children.map(child => ({
                    label: child.name,
                    key: child.path,
                    breadcrumb: child.meta.breadcrumb
                }));
            }

            return menuItem;
        });

    const menuBtns = [
        {
            image: searchImage,
            text: "Search"
        },
        {
            image: userImage,
            text: "Login"
        }
    ]

    return {
        menuList,
        menuBtns
    }
}